<?php

if (version_compare(phpversion(), '5', '<') === true)
{
    exit('phpFox 3.x requires PHP 5 or newer.');
}

define('PHPFOX', true);
define('PHPFOX_DS', DIRECTORY_SEPARATOR);
define('PHPFOX_DIR', dirname(__FILE__) . PHPFOX_DS);
require (PHPFOX_DIR . 'include' . PHPFOX_DS . 'init.inc.php');
require (PHPFOX_DIR . 'include' . PHPFOX_DS . 'setting' . PHPFOX_DS . 'server.sett.php');
$moduleID = "topcmmchat";
$db = new Phpfox_Database_Driver_Mysql;
if(!$db -> connect($_CONF['db']['host'], $_CONF['db']['user'], $_CONF['db']['pass'],$_CONF['db']['name']))
{
    echo 'connect error';
    exit;
}
$table = Phpfox::getT('product');
$select = "select * from " . $table . " where ;";
$aRows = $db->select('*')
                    ->from($table)
                    ->where("product_id = 'phpfox_123flashchat'")
                    ->execute('getRows');

if (!empty($aRows))
{
	$delete = "delete from " . $table . " where product_id = 'phpfox_123flashchat'";
	$db -> query($delete);
}
$table = Phpfox::getT('chat_settings');
$delete = "DROP TABLE IF EXISTS $table";
$db -> query($delete);



$table = Phpfox::getT('product');
$delete = "delete from " . $table . " where product_id = 'phpfox_123flashchat'";
$db -> query($delete);


$table = Phpfox::getT('module');
$delete = "delete from " . $table . " where module_id = '".$moduleID."'";
$db -> query($delete);


$table = Phpfox::getT('component');
$delete = "delete from " . $table . " where module_id = '".$moduleID."'";
$db -> query($delete);


$table = Phpfox::getT('block');
$delete = "delete from " . $table . " where module_id = '".$moduleID."'";
$db -> query($delete);


$table = Phpfox::getT('language_phrase');
$delete = "delete from " . $table . " where module_id = '".$moduleID."'";
$db -> query($delete);


$table = Phpfox::getT('menu');
$delete = "delete from " . $table . " where module_id = '".$moduleID."'";
$db -> query($delete);

echo 'Uninstall seccessfully.';

?>